requireJS(['constant' , 'site', 'handlebars'] , function ( constant , site ,Handlebars ) {
    var roleId;
    $('.collapse1').click(function () {
        $(this).parent('div').children('div').toggle();
    })
    $('.selection').each(function(){
        $(this).click(function(){
            $('.selection').css('background-color','white');
            $(this).css('background-color','blue')
            roleId=$(this).children('span').text();
            event.stopPropagation();
        })
    })

    $('.increase').click(function(){
        $('.jiedian').toggle();
    })
    var FlowDefine={
        key:'qy',
        name:'请假流程',
        flow:[
            {name:"开始",id:"1",nextId:'2'},
            {name:"初审",id:"2",nextId:'3',roleId:"person",nextRoleId:"manager"},
            {name:"审核",id:"3",nextId:'4',roleId:"manager",nextRoleId:""},
            {name:"结束",id:"4",nextId:''}
        ]
    }

    $('.json').click(function(){
        site.send({
            url:'',
            data:FlowDefine,
            callback:function(){
            }
        })
    })
    FlowDefine={
        key:'qy',
        name:'请假流程',
        flow:[
            {name:"开始",id:"1",nextId:'2'},
            {name:"初审",id:"2",nextId:'3',roleId:"person",nextRoleId:"manager"},
            {name:"审核",id:"3",nextId:'4',roleId:"manager",nextRoleId:""},
            {name:"结束",id:"4",nextId:''}
        ]
    }



    $('.submit').click(function(){
        var nextRoleId = $("input[type='radio']:checked").val();
        var data={
            name:$('#name').val(),
            flow:[
                {name:$('#jiedian').value,id:'1',nextId:'2'},
                {name:$('#jiedian').value,id:'2',nextId:'3',roleId: roleId,nextRoleId: nextRoleId},
                {name:$('#jiedian').value,id:'3',nextId:'4',roleId:"manager",nextRoleId:''},
                {name:$('#jiedian').value,id:'4',nextId:''}
            ]
        }
        site.send({
            data:JSON.stringify(data),
            url:'sjjfk',
            callback:function(){

            }
        })
    })
})